package com.qijian.maindata.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.qijian.common.annotation.Excel;
import com.qijian.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 工序工单派单人员对象 main_process_order_users
 *
 * @author qijian
 * @date 2021-10-09
 */
@EqualsAndHashCode(callSuper = true)
@Data
@ToString
@TableName("main_process_order_users")
public class ProcessOrderUsers extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @TableId
    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "主键")
    @Excel(name = "明细id", sort = 1)
    private Long wuId;

    /**
     * 派工ID
     */
//    @Excel(name = "派工ID")
    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "派工ID")
    private Long workId;

    /**
     * 用户ID
     */
    @NotNull(message = "作业人员不能为空")
//    @Excel(name = "用户ID")
    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "用户ID")
    private Long userId;

    @Excel(name = "作业人员", sort = 13)
    @ApiModelProperty(value = "用户姓名")
    private String nickName;

    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "部门ID")
    private Long deptId;

    @ApiModelProperty(value = "部门名称")
    @Excel(name = "作业人员所在车间", sort = 6)
    private String deptName;
    /**
     * 文件
     */
//    @Excel(name = "文件")
    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "文件")
    private Long pictureId;

    /**
     * 工时
     */
    @NotNull(message = "工时不能为空")
    @Excel(name = "工单工时(h)\n派工时-时间", sort = 15)
    @ApiModelProperty(value = "工单工时")
    private BigDecimal times;

    /**
     * 工时
     */
    @Excel(name = "实际工时(h)\n验收时-时间", sort = 15)
    @ApiModelProperty(value = "实际工时")
    private BigDecimal actualTimes;

    /**
     * 工价
     */
    @NotNull(message = "工价不能为空")
    @Excel(name = "工价", sort = 16)
    @ApiModelProperty(value = "工价")
    private BigDecimal prices;


    /**
     * 工价
     */
    @NotNull(message = "是否辅助人员")
    @Excel(name = "是否辅助人员", sort = 17)
    @ApiModelProperty(value = "是否辅助人员")
    private Boolean isSupport;

    /**
     * 接单时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "接单时间")
    private Date receiveTime;

    /**
     * 完工时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "完工时间")
    private Date reportTime;

    /**
     * 验收时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "验收时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", sort = 21)
    @ApiModelProperty(value = "验收时间")
    private Date checkTime;

    /**
     * 备注
     */
    @Excel(name = "备注", sort = 17)
    @ApiModelProperty(value = "备注")
    private String remark;

    /**
     * 状态（0-完成，1-待接单，2-已接单，3-停机待料）
     */
    @Excel(name = "状态", readConverterExp = "0=完成,1=待接单,2=已接单,3=停机待料,4=待验收", sort = 18)
    @ApiModelProperty(value = "状态（0-完成，1-待接单，2-已接单，3-停机待料）")
    private Integer status;

    /**
     * 状态（0-完成，1-待接单，2-已接单，3-停机待料）
     */
    @Excel(name = "是否开发件", readConverterExp = "0=飞开发件,1=开发件", sort = 19)
    private Boolean isDevelop;


    private String delayType;


    private String delayReason;

    //2024.7.23 当出现质量问题需要暂停该工单，可由车间主任忽略该工单，允许员工继续接单，但不计算收益；
    @ApiModelProperty(value = "是否忽略")
    private Boolean isIgnore;

    @ApiModelProperty(value = "比例")
    @TableField(exist = false)
    private BigDecimal rate;

}
